home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 95 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: atlas.axiom.net!usenet
  2. From: Dave Nulton <dnult@axiom.net>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: How to make a Complex class
  5. Date: 1 Jan 1996 18:11:21 GMT
  6. Organization: Axiom Communications
  7. Message-ID: <4c984a$99t@atlas.axiom.net>
  8. References: <4c8kdm$p0q@news.csie.nctu.edu.tw>
  9. NNTP-Posting-Host: node094.axiom.net
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.1N (Windows; I; 16bit)
  14.  
  15. I've just been working with complex classes myself in C++.  The 
  16. class is in there.  There is already a library installed in my 
  17. compiler - use it by including <complex.h>.  It defines a 
  18. structure you use called complex.  Define a number something like 
  19. this.
  20.  
  21. complex(double r, double i);
  22.  
  23. As far as your format (typical mathmatical format) you'll have to 
  24. format you output and parse you input to make it work properly.
  25.  
  26. The advantage to the complex library is that most all of the math 
  27. functions and stream operators have been overloaded to handle the 
  28. complex math.  In addition there are several standard functions.  
  29. The only thing not included is polar operators, but those are easy 
  30. to construct.
  31.  
  32. Hope that helps
  33. -dnult
  34.  
  35.